package com.ansion.basedb.database.sql;

import android.database.Cursor;

import androidx.annotation.NonNull;


/**
 * created by zhaoyuntao
 * on 27/04/2023
 */
abstract class DBBaseOperation<T> {
    private final String tag;
    @DBOperationCode
    private final int dbOperationCode;
    private boolean dump;

    public DBBaseOperation(@NonNull String tag, @DBOperationCode int dbOperationCode) {
        this.tag = tag;
        this.dbOperationCode = dbOperationCode;
    }

    final public String getTag() {
        return tag;
    }

    final public int getDbOperationCode() {
        return dbOperationCode;
    }

    final public DBBaseOperation<T> setDump(boolean dump) {
        this.dump = dump;
        return this;
    }

    final public boolean dump() {
        return dump;
    }

    public abstract Cursor op(@NonNull T sqLiteDatabase, DBTaskState state);

    public abstract void execute(@NonNull DBTaskState state, @NonNull SQLTransactionListener listener);
}
